import os, sys
#import pandas as pd
# in jupyter notebook current_path get with dir '.'
# current_path = os.path.abspath('.')
current_path = os.path.dirname(os.path.realpath(__file__))
sys.path.append(current_path+'/..')

from core.database import DatabaseConnectionManager,OpenGaussConnectionManager

if __name__ == "__main__":
    try:
        #manager=DatabaseConnectionManager(current_path+"/config.yaml")
        manager=OpenGaussConnectionManager(current_path+"/config.yaml")
        """
        engine=manager.__create_engine()
        意外错误: type object 'DatabaseConnectionManager' has no attribute '_DatabaseConnectionManager_create_engine'
        绕过私有方法不可见，_classname__private_method()
        engine=manager._DatabaseConnectionManager__create_engine()
        """
        print("dns {}".format(manager.dsn))
        conn=manager.connect()
    except ValueError as e:
        print(f"配置错误: {e}")
    except Exception as e:
        print(f"意外错误: {e}")